<template>
    <div>
        <el-dialog
            :title="title"
            :close-on-click-modal="false"
            v-dialogDrag
            :visible.sync="editVisible"
        >
            <span>
                <h2>{{ $dictUtils.getDictLabel("warnType", editForm.warnType, "") }}</h2>
                <br>

            </span>
            <span>{{ editForm.warnDescribe}}</span>
            <span slot="footer" class="dialog-footer">
        <div class="footer-input">
            <el-button size="small" v-if="editForm.dealType===1" type="primary" @click="doSubmit('0')"
                       v-noMoreClick>允许</el-button>
            <el-button size="small" v-if="editForm.dealType===1" type="danger" @click="doSubmit('1')"
                       v-noMoreClick>阻止</el-button>
            <el-button size="small" v-if="editForm.dealType===2" @click="doSubmit('2')">关闭</el-button>

        </div>

      </span>
        </el-dialog>
    </div>
</template>
<script>
    import {save} from '@/api/warnInfo/WarnInfo.js';

    export default {
        components: {},
        data() {
            return {
                loading: false,
                areaLabel: {},
                method: '',
                title: '',
                editForm: {
                    id: '',
                    warnType: '',
                    truckTrailId: '',
                    truckTrailExtendId: '',
                    warnDescribe: '',
                    state: '',
                    dealType: '',
                    dealResult: '',
                    dealUserId: '',
                    dealTime: ''
                },
                editVisible: false,
                detailsVisible: false,
                tableData1: [],
                page: {
                    pageSize: 10,
                    pageNo: 1,
                    total: 0
                },
                props: 1,
                dialogVisible: false,
                query: ''
            }
        },
        methods: {
            select(e) {
                this.editForm.companyName = e.names
                this.editForm.companyId = e.id
                this.dialogVisible = false
                console.log(e)
            },
            init(method, obj) {
                if (method === 'info') {
                    console.log(obj)
                    this.editVisible = true
                    this.editForm = obj
                    console.log(this.editForm)
                    this.title = '预警'
                    this.visible = true
                    this.loading = false
                }

            },
            close() {
                this.editVisible = false
            },
            doSubmit(dealResult) {
                this.$set(this.editForm, 'dealResult', dealResult)
                save(this.editForm).then((res) => {
                    if (res.data.code === '200') {
                        this.$message({
                            message: '编辑成功',
                            type: 'success'
                        })
                        this.editVisible = false
                        this.$emit('refreshDataList')
                    }
                })
            }
        },
        mounted() {

        }
    }
</script>
<style lang="scss" scoped>
    ::v-deep .el-dialog {
        .el-form {
            .el-input__inner {
                width: 320px;
            }

            .inputAppend-wrapper {
                .el-input__inner {
                    width: 282px;
                }
            }
        }
    }
</style>
